

<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <meta name="layout" content="main" />
  <title>Position List</title>
</head>
<body>
<g:javascript library="scriptaculous" />
<g:javascript library="prototype" />
<div class="nav">
  <span class="menuButton"><a class="home" href="${createLinkTo(dir:'')}">Home</a></span>
  <span class="menuButton"><g:link controller="userAccount" class="logout" action="logout">Logout</g:link></span>
</div>
<div class="body">
  <h1>Position List</h1>
  <g:if test="${flash.message}">
    <div class="message">${flash.message}</div>
  </g:if>
  <div id = "plist" class="list">
    <table>
      <thead>
      <tr>

        <g:sortableColumn property="id" title="Id" />

        <g:sortableColumn property="name" title="Name" />

        <g:sortableColumn property="description" title="Description" />

        <g:sortableColumn property="location" title="Location" />

        <g:sortableColumn property="requiredVolunteers" title="Required Volunteers" />

        <g:sortableColumn property="noOfVolunteerOpenPosition" title="No of open Volunteer Positions" />

        <th>Event</th>

      </tr>
      </thead>
      <tbody>
      <g:each in="${positionInstanceList}" status="i" var="positionInstance">
        <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">



          <td><g:link action="show" id="${positionInstance.id}">${fieldValue(bean:positionInstance, field:'id')}</g:link></td>
          <td>${fieldValue(bean:positionInstance, field:'name')}</td>

          <td>${fieldValue(bean:positionInstance, field:'description')}</td>

          <td>${fieldValue(bean:positionInstance, field:'location')}</td>

          <td>${fieldValue(bean:positionInstance, field:'requiredVolunteers')}</td>

          <td>${fieldValue(bean:positionInstance, field:'noOfVolunteerOpenPosition')}</td>

          <td>${fieldValue(bean:positionInstance, field:'event')}</td>

          <g:javascript>
                prinln "HERE"
                new Ajax.PeriodicalUpdater('plist',
                            '<g:createLink action="list" id="${positionInstance.event.id}" />',
                        {frequency: 5, maxFrequency: 20, decay: 2});
           </g:javascript>

        </tr>
    
      </g:each>
      </tbody>
    </table>
  </div>
  <div class="paginateButtons">
    <g:paginate total="${positionInstanceTotal}" />

  </div>



</div>
</body>
</html>
